﻿using Sidvall.Serialization;
using System;

namespace Sidvall.UI.Uwp.Converters
{
    public class Int32ToBooleanConverter : ValueToBooleanConverterBase
    {
        #region Public Members

        #region BooleanToValue

        protected override object BooleanToValue(object value, Type targetType, object parameter, string language)
        {
            if (value.ToBoolean(false))
            {
                if (!this.Not)
                    return parameter.ToNullableInt32();
                else
                    return null;
            }
            else
            {
                if (!this.Not)
                    return null;
                else
                    return parameter.ToNullableInt32();
            }
        }

        #endregion

        #endregion
    }
}
